{include file="common/header"/}

<div class="layui-fluid">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
      <div class="layui-card">
        <div class="layui-card-body">
          <blockquote class="layui-elem-quote layui-quote-nm">
            <div class="layui-btn-group">
              <a href="javascript:;" class="layui-btn layui-btn-sm" onclick="open_frame('添加','{:url('add')}');"><i class="layui-icon layui-icon-add-circle"></i>{:lang('add')}规则</a>
            </div>
          </blockquote>
          <div class="layui-row">
          <table class="layui-table" id="list" lay-filter="list"></table>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

{include file="common/footer"/}


<script type="text/html" id="statusTpl">
  <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="status" {{ d.status == 1 ? 'checked' : '' }}>
</script>
<script type="text/html" id="action">
<div class="layui-btn-group">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="selectkey"></a>
</div>
</script>


<script>
var table;
var searchObj = {};
var tree;
var channel_ids = [];
searchObj['wx_id'] = '{$wx_id}';
layui.use(['table','form','laydate','tree'],function(){
  table = layui.table;
  tree = layui.tree;
  var form = layui.form;
  table.render({
    elem: '#list'
    ,url:'{:url("select")}'
    ,method:'post'
    ,where:searchObj
    ,cellMinWidth: 60
    ,limit:20
    ,limits:[20,40,60,80,100]
    ,title: '规则列表'
    ,id:'list'
    ,cols: [[
        {type:'checkbox',fixed: true}
        ,{field:'keys', title: '关键字',fixed: true}
        ,{field:'msgtype', title: '类型', templet:'#imageTpl'}
        ,{field:'create_at', title: '添加时间'}
        ,{title: '状态', templet:'#statusTpl'}
        ,{title: '操作', templet:'#action'}
    ]]
    ,page: true
  });
});

</script>
